<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"

      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      >
    <h:body>

        <ui:composition template="/WEB-INF/templates/commonLayout.xhtml">

            <ui:define name="content">

                <f:view>
                    <h:form>
                        <!--                        <h1><h:outputText emptyMessage="No plans saved" paginator="true" rows="10" value="Factory offers"/></h1>-->
                        <!--                        <div class="title"> 
                                                    <h:outputLabel id="plansTitle">Factory offers</h:outputLabel>
                        
                                                </div>-->
                        <p:panel id="panel" header="Factory Offers">  
                            <p:dataTable value="#{schedulerBackingBean.plans}" var="item" styleClass="plansTable">
                                <p:column styleClass="column">
                                    <f:facet name="header">
                                        <h:outputText value="Your input ID"/>
                                    </f:facet>
                                    <h:outputText value="#{item.inputId}" />
                                </p:column>

                                <p:column styleClass="column">
                                    <f:facet name="header">
                                        <h:outputText value="Finishing time"/>
                                    </f:facet>
                                    <h:outputText value="#{item.time}" />
                                </p:column>

                                <p:column styleClass="column">
                                    <f:facet name="header">
                                        <h:outputText value="Price"/>
                                    </f:facet>
                                    <h:outputText value="#{item.price}"/>
                                </p:column>

                                <p:column styleClass="column">
                                    <f:facet name="header">
                                        <h:outputText value="user"/>
                                    </f:facet>
                                    <h:outputText value="#{item.userId}"/>
                                </p:column>

                                <p:column styleClass="column">
                                    <p:commandButton action="#{schedulerBackingBean.runFactory(item)}" value="Run" ajax="false" disabled="#{!item.supported}" onclick="dlg1.show();"/>
                                </p:column>
                            </p:dataTable>

                        </p:panel>   
                    </h:form> 

                    <p:dialog id="modalDialog" header="Preparing for execution" widgetVar="dlg1" modal="true" height="200" closable="false">  
                        <h:outputText value="Registering chosen plan and preparing for execution. Please wait...!" />  
                    </p:dialog>  
                </f:view>

            </ui:define>
        </ui:composition>

    </h:body>

</html>